package com.ioidea.ble.proto;

public class ProtoStrHelper {


    public static String getStringAddSpace(String originStr) {
        String regex = "(.{2})";
        String newStr=originStr.replaceAll(regex, "$1 ");
        // 去掉尾部多余空格
        return newStr.substring(0,newStr.length()-1);
    }

    public static String get2ByteHexString(String originHexStr) {
        StringBuilder sb = new StringBuilder();
        switch (originHexStr.length()) {
            case 1:
                sb.append("000").append(originHexStr);
                break;
            case 2:
                sb.append("00").append(originHexStr);
                break;
            case 3:
                sb.append("0").append(originHexStr);
                break;
        }
        return sb.toString();
    }
}
